package com.algorithm;

public class MoveZeroes {
    public static void main(String[] args){
       int[] nums = new int[]{0,1,0,3,12};
        if (nums == null || nums.length == 0) return;

        int insertPos = 0;
        for (int num: nums) {
            if (num != 0) nums[insertPos++] = num;
        }

        for (int item:nums) {
            System.out.print(item+" ");
        }

        System.out.println("");
        while (insertPos < nums.length) {
            nums[insertPos++] = 0;
        }

        for (int item:nums) {
            System.out.print(item+" ");
        }
    }
}
